package com.yanjiali.controller;

import com.yanjiali.model.R;
import com.yanjiali.model.req.UpdatePasswordReq;
import com.yanjiali.model.req.ValidatePasswordReq;
import com.yanjiali.model.resp.UpdatePasswordResp;
import com.yanjiali.model.resp.ValidatePasswordResp;
import com.yanjiali.service.EncryptCollectUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Package: com.yanjiali.controller
 * @Author: yanjiali
 * @Created: 2025/4/27 14:12
 */
@Api(tags = "用户加密收藏控制器")
@RestController
@RequestMapping("/v1/encryptCollectUser")
public class EncryptCollectUserController {

    @Autowired
    private EncryptCollectUserService encryptCollectUserService;

    @PostMapping("/validatePassword")
    @ApiOperation("验证用户隐私收藏夹密码，并获取对应二级目录集合")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "validatePasswordReq", value = "验证隐私收藏夹密码的请求参数")
    })
    public R<ValidatePasswordResp> validatePassword(@RequestBody ValidatePasswordReq validatePasswordReq) {
        return encryptCollectUserService.validatePassword(validatePasswordReq);
    }

    @PostMapping("/updatePassword")
    @ApiOperation("修改隐私收藏夹密码")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "updatePasswordReq", value = "修改隐私收藏夹密码请求参数")
    })
    public R<UpdatePasswordResp> updatePassword(@RequestBody UpdatePasswordReq updatePasswordReq) {
        return encryptCollectUserService.updatePassword(updatePasswordReq);
    }
}
